
module.exports = function(options) {
 

  options = options || {};

  return function execFile() {
    let childProcess = window.require('child_process');

    let child = childProcess.execFile.apply(childProcess, arguments);

    if (!options.bufferStdout) {
      child.stdout.removeAllListeners('data');
    }

    if (!options.bufferStderr) {
      child.stderr.removeAllListeners('data');
    }

    return child;
  };
};

//// export const  function(options){
////   options = options || {};
////   let childProcess = window.require && window.require('child_process');

////   let child = childProcess.execFile.apply(childProcess, arguments);

////   if (!options.bufferStdout) {
////     child.stdout.removeAllListeners('data');
////   }

////   if (!options.bufferStderr) {
////     child.stderr.removeAllListeners('data');
////   }

////   return child;
//// };